<?php
//简单管理页面范例，在你的管理页面引用coresection/checkA.php就OK，当然，不要忘了添加注销登录的链接
include_once '../coresection/checkA.php';
?>

<? $system_part = $_REQUEST ['now_extender']; ?>

<?
include_once("../../config_controller.php");
$host = $_SERVER['HTTP_HOST']; //取得进入所输入的域名
$theme_folder = host_theme($host);

include_once '../../front/' . $theme_folder . '/connection.php';include_once '../coresection/check_session.php';;
?>

<?php include_once ("function.php");?>
<?php include "../../front/".$theme_folder."/config.php" ;?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once('module/head.php'); ?>


</head>

<body>


<?php
$trans_term_nid=$_REQUEST['nid'];
?>


 


<?
//设置需要搜索的表格的前缀后缀
$table_Suffix=$sys_list_table;
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀
 
$query = mysql_query("SELECT COUNT(nid) FROM $table where (term0=$trans_term_nid or term1=$trans_term_nid or term2=$trans_term_nid or term3=$trans_term_nid or term4=$trans_term_nid or term5=$trans_term_nid) and belong = '$sys_belong'");
$sum = mysql_result($query, 0);
 
 
//设置需要搜索的表格的前缀后缀
$table_Suffix=$sys_term_table;
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀
 
$query = mysql_query("SELECT COUNT(nid) FROM $table where (term0=$trans_term_nid or term1=$trans_term_nid or term2=$trans_term_nid or term3=$trans_term_nid or term4=$trans_term_nid or term5=$trans_term_nid) and belong = '$sys_belong'");
$termsum = mysql_result($query, 0);

 
if($sum>0 or $termsum>0)
{
?>


<script type="text/javascript">
 
alert("此分类中还包含产品或者子分类，请先清空此分类下的产品和子分类.");
document.location.href = "term-list.php?now_extender=<? echo $system_part ?>";
</script>

<? }

else
{
 
//设置需要搜索的表格的前缀后缀
$table_Suffix=$sys_term_table;
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀
 
	$sql = " DELETE FROM $table WHERE nid=$trans_term_nid";
	sql_log($sql);
$query=mysql_query($sql) or die ('删除失败查询失败');
    mysql_close($con); 


?>

<?
//设置需要搜索的表格的前缀后缀
$table_Suffix='relation';
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀

$sql = " DELETE FROM $table WHERE term_nid=$trans_term_nid";
sql_log($sql);
$query=mysql_query($sql) or die ('删除数据失败');


$table_Suffix='brand_term_relation';
$table=$table_Prefix.$table_Suffix;
//设置需要搜索的表格的前缀后缀

$sql = " DELETE FROM $table WHERE term_id=$trans_term_nid";
sql_log($sql);
$query=mysql_query($sql) or die ('删除数据失败');

mysql_close($con);

?>
 



 

<script type="text/javascript">
 
alert("资料已删除，请点击确认返回继续操作!");
document.location.href = "term-list.php?now_extender=<? echo $system_part ?>";
</script>
 
 
<? } ?>

</body>